package C11_11_ReplaceInheritanceWithDelegation.refactorbefore;

import java.util.Vector;

/**
 * @ClassName : MyStack
 * @Description : 以委托取代继承
 * @Author : wukj1
 * @Date: 2022/8/16
 **/
public class MyStack extends Vector {

    @Override
    public boolean remove(Object o) {
        return removeElement(o);
    }

    @Override
    public void add(int index, Object element) {
        insertElementAt(element, index);
    }

    @Override
    public synchronized int size() {
        return elementCount;
    }

    @Override
    public synchronized boolean isEmpty() {
        return elementCount == 0;
    }
}
